library(data.table)
library(multcomp)
library(texreg)

# set working directory to location where R script and data file exist
setwd("")

responses <- fread("termlimits_responses.csv", header = TRUE, stringsAsFactors = FALSE)

################################################################################

# FIGURE 1

# H1: when governor is term-limited, bureaucrats less likely to exert effort on
# governor's priorities
implementation_effort <- lm(termlimits_effort ~ termlimits_condition, data = responses)
summary(implementation_effort)
# are the re-election and term-limit conditions different?
summary(glht(implementation_effort, linfct = "termlimits_conditionReelection - termlimits_conditionTermLimited = 0"))

# H2: when governor is term-limited, bureaucrats less likely to take governor's
# preferences into account
gov_stakeholder <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses)
summary(gov_stakeholder)
# are the re-election and term-limit conditions different?
summary(glht(gov_stakeholder, linfct = "termlimits_conditionReelection - termlimits_conditionTermLimited = 0"))

pdf(file = "eo_implementation.pdf", family = "Times", height = 5, width = 10)
layout(matrix(c(1,2), nrow=1, byrow=TRUE), widths = c(0.5,0.4))
par(mar=c(5,11,6,1))
plot(NULL, ylim=c(0.5, 2.5), xlim=c(-0.2,0.20), axes=FALSE,  bg = "black",
     tck=-.02, cex.axis=0.9, cex=1.5, cex.main = 3,
     xlab="", ylab="", yaxt="n", xaxt="n")
points(coef(implementation_effort)[2:3],
       c(2,1),
       pch=19, cex=1.75,
       panel.first = c(abline(v=0,lwd=2, col="gray90",lty=2)))
segments(x0=confint(implementation_effort, level = 0.90)[2:3,1],
         x1=confint(implementation_effort, level = 0.90)[2:3,2],
         y0=c(2,1), cex=1.75)
axis(1,at=c(-0.20, 0.00, 0.2),
     labels=c("-0.20", "0.00", "0.20"),cex.axis = 2, lwd=2)
axis(2,at=c(2,1),
     las=2,
     labels=c("Running for\nRe-election",
              "Term-Limited"),
     tck=0,
     lwd =0,
     line = 0,
     cex.axis=2)
mtext("Difference from Baseline", side=1, line = 3, cex = 2)
mtext("Implementation\nEffort Exerted", side=3, line = 1, cex = 2.5)
text(coef(implementation_effort)[2:3],
     c(2,1)+0.2,
     paste0(sprintf("%.2f",round(coef(implementation_effort)[2:3], 2))), cex=2.00)
par(mar=c(5,4,6,1))
plot(NULL, ylim=c(0.5, 2.5), xlim=c(-0.50,0.25), axes=FALSE,  bg = "black",
     tck=-.02, cex.axis=0.9, cex=1.5, cex.main = 3,
     xlab="", ylab="", yaxt="n", xaxt="n")
points(coef(gov_stakeholder)[2:3],
       c(2,1),
       pch=19, cex=1.75,
       panel.first = c(abline(v=0,lwd=2, col="gray90",lty=2)))
segments(x0=confint(gov_stakeholder, level = 0.90)[2:3,1],
         x1=confint(gov_stakeholder, level = 0.90)[2:3,2],
         y0=c(2,1), cex=1.75)
axis(1,at=c(-0.50, -0.25, 0.00, 0.25),
     labels=c("0.50", "-0.25", "0.00", "0.25"),cex.axis = 2, lwd=2)
mtext("Difference from Baseline", side=1, line = 3, cex = 2)
mtext("Importance of\nGovernor's Preferences", side=3, line = 1, cex = 2.5)
text(coef(gov_stakeholder)[2:3],
     c(2,1)+0.2,
     paste0(sprintf("%.2f",round(coef(gov_stakeholder)[2:3], 2))), cex=2.00)
dev.off()

################################################################################

# TABLE SI.1

# of unique respondents per state who provided a response for at least one of
# the two key outcome questions
table(responses$state[which(!is.na(responses$termlimits_effort) |
                              !is.na(responses$termlimits_governor_resp))])

################################################################################

# TABLE SI.2

# respondent demographics for those who provided a response for at least one of
# the two key outcome questions

# gender
table(responses$gender[which(!is.na(responses$termlimits_effort) |
                               !is.na(responses$termlimits_governor_resp))])
round(prop.table(table(responses$gender[which(!is.na(responses$termlimits_effort) |
                                                !is.na(responses$termlimits_governor_resp))]))*100,1)

# age
table(responses$age[which(!is.na(responses$termlimits_effort) |
                            !is.na(responses$termlimits_governor_resp))])
round(prop.table(table(responses$age[which(!is.na(responses$termlimits_effort) |
                                             !is.na(responses$termlimits_governor_resp))]))*100,1)

# income
table(responses$income[which(!is.na(responses$termlimits_effort) |
                               !is.na(responses$termlimits_governor_resp))])
round(prop.table(table(responses$income[which(!is.na(responses$termlimits_effort) |
                                                !is.na(responses$termlimits_governor_resp))]))*100,1)

# education
table(responses$education[which(!is.na(responses$termlimits_effort) |
                                  !is.na(responses$termlimits_governor_resp))])
round(prop.table(table(responses$education[which(!is.na(responses$termlimits_effort) |
                                                   !is.na(responses$termlimits_governor_resp))]))*100,1)

# race
table(responses$race[which(!is.na(responses$termlimits_effort) |
                             !is.na(responses$termlimits_governor_resp))])
round(prop.table(table(responses$race[which(!is.na(responses$termlimits_effort) |
                                              !is.na(responses$termlimits_governor_resp))]))*100,1)

# Hispanic
table(responses$hispanic[which(!is.na(responses$termlimits_effort) |
                                 !is.na(responses$termlimits_governor_resp))])
round(prop.table(table(responses$hispanic[which(!is.na(responses$termlimits_effort) |
                                                  !is.na(responses$termlimits_governor_resp))]))*100,1)

# PID
table(responses$pid7[which(!is.na(responses$termlimits_effort) |
                             !is.na(responses$termlimits_governor_resp))], useNA = "always")
round(prop.table(table(responses$pid7[which(!is.na(responses$termlimits_effort) |
                                              !is.na(responses$termlimits_governor_resp))], useNA = "always"))*100,1)

# ideology
table(responses$ideology[which(!is.na(responses$termlimits_effort) |
                                 !is.na(responses$termlimits_governor_resp))])
round(prop.table(table(responses$ideology[which(!is.na(responses$termlimits_effort) |
                                                  !is.na(responses$termlimits_governor_resp))]))*100,1)

# years exp total
table(responses$years_exp_total[which(!is.na(responses$termlimits_effort) |
                                        !is.na(responses$termlimits_governor_resp))])
round(prop.table(table(responses$years_exp_total[which(!is.na(responses$termlimits_effort) |
                                                         !is.na(responses$termlimits_governor_resp))]))*100,1)

# appointed/civil service
table(responses$job_classification[which(!is.na(responses$termlimits_effort) |
                                           !is.na(responses$termlimits_governor_resp))])
round(prop.table(table(responses$job_classification[which(!is.na(responses$termlimits_effort) |
                                                            !is.na(responses$termlimits_governor_resp))]))*100,1)

################################################################################

# TABLE SI.3

wordreg(l=list(implementation_effort, gov_stakeholder),
        file = "TermLimitsExp.doc",
        custom.coef.map = list("(Intercept)" = "Intercept",
                               "termlimits_conditionReelection" = "Governor Running for Re-election",
                               "termlimits_conditionTermLimited" = "Governor Term-limited"),
        custom.model.names = c("Implementation Effort Exerted", "Importance of Governor as Stakeholder"),
        caption = "Effect of Gubernatorial Term Limits on Bureaucratic Implementation of Executive Orders",
        caption.above = TRUE,
        stars = 0.10, # our pre-registration specified a critical value threshold 
                      # of p<=0.05 one-tailed, which is equivalent to p<=0.10 two-tailed
        include.rsquared = FALSE,
        include.adjrs = FALSE)

################################################################################

# TABLE SI.4

# placebo outcomes for H2--other stakeholders
director_stakeholder <- lm(termlimits_director_resp ~ termlimits_condition, data = responses)
summary(director_stakeholder)
employees_stakeholder <- lm(termlimits_employees_resp ~ termlimits_condition, data = responses)
summary(employees_stakeholder)
stateleg_stakeholder <- lm(termlimits_stateleg_resp ~ termlimits_condition, data = responses)
summary(stateleg_stakeholder)
intgroups_stakeholder <- lm(termlimits_intgroups_resp ~ termlimits_condition, data = responses)
summary(intgroups_stakeholder)
residents_stakeholder <- lm(termlimits_residents_resp ~ termlimits_condition, data = responses)
summary(residents_stakeholder)

wordreg(l=list(gov_stakeholder, director_stakeholder, employees_stakeholder,
               stateleg_stakeholder, intgroups_stakeholder, residents_stakeholder),
        file = "TermLimitsStakeholders.doc",
        custom.coef.map = list("(Intercept)" = "Intercept",
                               "termlimits_conditionReelection" = "Governor Running for Re-election",
                               "termlimits_conditionTermLimited" = "Governor Term-limited"),
        custom.model.names = c("Governor", "Agency Director", "Agency Employees", "Legislature",
                               "Interest Groups", "State Residents"),
        caption = "Effect of Gubernatorial Term Limits on Importance of Stakeholder Preferences When
                    Implementing Executive Orders",
        caption.above = TRUE,
        stars = 0.10, # our pre-registration specified a critical value threshold 
                      # of p<=0.05 one-tailed, which is equivalent to p<=0.10 two-tailed
        include.rsquared = FALSE,
        include.adjrs = FALSE)

################################################################################

# TABLE SI.5

# recoding respondent ideology as a seven-point scale
responses$ideo_num <- ifelse(responses$ideology=="Very liberal", 1, NA)
responses$ideo_num <- ifelse(responses$ideology=="Liberal", 2, responses$ideo_num)
responses$ideo_num <- ifelse(responses$ideology=="Slightly liberal", 3, responses$ideo_num)
responses$ideo_num <- ifelse(responses$ideology=="Moderate", 4, responses$ideo_num)
responses$ideo_num <- ifelse(responses$ideology=="Slightly conservative", 5, responses$ideo_num)
responses$ideo_num <- ifelse(responses$ideology=="Conservative", 6, responses$ideo_num)
responses$ideo_num <- ifelse(responses$ideology=="Very conservative", 7, responses$ideo_num)

# H1: when governor is term-limited, bureaucrats less likely to exert effort on
# governor's priorities
implementation_effort_int <- lm(termlimits_effort ~ termlimits_condition*ideo_num, data = responses)
summary(implementation_effort_int)

# H2: when governor is term-limited, bureaucrats less likely to take governor's
# preferences into account

gov_stakeholder_int <- lm(termlimits_governor_resp ~ termlimits_condition*ideo_num, data = responses)
summary(gov_stakeholder_int)

wordreg(l=list(implementation_effort_int, gov_stakeholder_int),
        file = "TermLimitsExpInt.doc",
        custom.coef.map = list("(Intercept)" = "Intercept",
                               "termlimits_conditionReelection" = "Re-election Treatment",
                               "termlimits_conditionTermLimited" = "Term Limited Treatment",
                               "ideo_num" = "Resp. Ideology (D-->R)",
                               "termlimits_conditionReelection:ideo_num" = "Re-election:Ideology",
                               "termlimits_conditionTermLimited:ideo_num" = "Term Limited:Ideology"),
        custom.model.names = c("Implementation Effort Exerted", "Importance of Governor as Stakeholder"),
        caption = "Effect of Governor's Tenure on Bureaucratic Responsiveness to Executive Order, Conditioned by Respondent Ideology",
        caption.above = TRUE,
        stars = 0.10, # our pre-registration specified a critical value threshold 
                      # of p<=0.05 one-tailed, which is equivalent to p<=0.10 two-tailed
        include.rsquared = FALSE,
        include.adjrs = FALSE)

################################################################################

# TABLES SI.6 AND SI.7

# CONNECTICUT

implementation_effort_ct <- lm(termlimits_effort ~ termlimits_condition, data = responses[which(responses$state=="Connecticut")])
summary(implementation_effort_ct)

gov_stakeholder_ct <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses[which(responses$state=="Connecticut")])
summary(gov_stakeholder_ct)

#FLORIDA

implementation_effort_fl <- lm(termlimits_effort ~ termlimits_condition, data = responses[which(responses$state=="Florida")])
summary(implementation_effort_fl)

gov_stakeholder_fl <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses[which(responses$state=="Florida")])
summary(gov_stakeholder_fl)

# ILLINOIS

implementation_effort_il <- lm(termlimits_effort ~ termlimits_condition, data = responses[which(responses$state=="Illinois")])
summary(implementation_effort_il)

gov_stakeholder_il <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses[which(responses$state=="Illinois")])
summary(gov_stakeholder_il)

# INDIANA

implementation_effort_in <- lm(termlimits_effort ~ termlimits_condition, data = responses[which(responses$state=="Indiana")])
summary(implementation_effort_in)

gov_stakeholder_in <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses[which(responses$state=="Indiana")])
summary(gov_stakeholder_in)

# NEBRASKA

implementation_effort_ne <- lm(termlimits_effort ~ termlimits_condition, data = responses[which(responses$state=="Nebraska")])
summary(implementation_effort_ne)

gov_stakeholder_ne <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses[which(responses$state=="Nebraska")])
summary(gov_stakeholder_ne)

# NEW HAMPSHIRE

implementation_effort_nh <- lm(termlimits_effort ~ termlimits_condition, data = responses[which(responses$state=="New Hampshire")])
summary(implementation_effort_nh)

gov_stakeholder_nh <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses[which(responses$state=="New Hampshire")])
summary(gov_stakeholder_nh)

# NORTH CAROLINA

implementation_effort_nc <- lm(termlimits_effort ~ termlimits_condition, data = responses[which(responses$state=="North Carolina")])
summary(implementation_effort_nc)

gov_stakeholder_nc <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses[which(responses$state=="North Carolina")])
summary(gov_stakeholder_nc)

# OREGON

implementation_effort_or <- lm(termlimits_effort ~ termlimits_condition, data = responses[which(responses$state=="Oregon")])
summary(implementation_effort_or)

gov_stakeholder_or <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses[which(responses$state=="Oregon")])
summary(gov_stakeholder_or)

# VERMONT
implementation_effort_vt <- lm(termlimits_effort ~ termlimits_condition, data = responses[which(responses$state=="Vermont")])
summary(implementation_effort_vt)

gov_stakeholder_vt <- lm(termlimits_governor_resp ~ termlimits_condition, data = responses[which(responses$state=="Vermont")])
summary(gov_stakeholder_vt)

# TABLE SI.6

wordreg(l=list(implementation_effort_ct, implementation_effort_fl,
               implementation_effort_il, implementation_effort_in,
               implementation_effort_ne, implementation_effort_nh,
               implementation_effort_nc, implementation_effort_or,
               implementation_effort_vt),
        file = "TermLimitsExp_effortbystate.doc",
        custom.coef.map = list("(Intercept)" = "Intercept",
                               "termlimits_conditionReelection" = "Governor Running for Re-election",
                               "termlimits_conditionTermLimited" = "Governor Term-limited"),
        custom.model.names = c("CT", "FL", "IL", "IN", "NE", "NH", "NC", "OR", "VT"),
        caption = "Effect of Gubernatorial Term Limits on Bureaucratic Effort by State",
        caption.above = TRUE,
        stars = 0.10,
        include.rsquared = FALSE,
        include.adjrs = FALSE)

# TABLE SI.7

wordreg(l=list(gov_stakeholder_ct, gov_stakeholder_fl,
               gov_stakeholder_il, gov_stakeholder_in,
               gov_stakeholder_ne, gov_stakeholder_nh,
               gov_stakeholder_nc, gov_stakeholder_or,
               gov_stakeholder_vt),
        file = "TermLimitsExp_stakeholderbystate.doc",
        custom.coef.map = list("(Intercept)" = "Intercept",
                               "termlimits_conditionReelection" = "Governor Running for Re-election",
                               "termlimits_conditionTermLimited" = "Governor Term-limited"),
        custom.model.names = c("CT", "FL", "IL", "IN", "NE", "NH", "NC", "OR", "VT"),
        caption = "Effect of Gubernatorial Term Limits on Bureaucratic Effort by State",
        caption.above = TRUE,
        stars = 0.10,
        include.rsquared = FALSE,
        include.adjrs = FALSE)

################################################################################

# TABLE SI.8

# creating a dichotomous indicator for whether states have term limits
responses$gov_termlimits <- ifelse(responses$state %in% c("Florida", "Indiana",
                                                          "Nebraska", "North Carolina",
                                                          "Oregon"), 1, NA)
responses$gov_termlimits <- ifelse(responses$state %in% c("Connecticut", "Illinois",
                                                          "New Hampshire",
                                                          "Vermont"), 0, responses$gov_termlimits)

# H1: when governor is term-limited, bureaucrats less likely to exert effort on
# governor's priorities
implementation_effort_govtermlimits <- lm(termlimits_effort ~ termlimits_condition*gov_termlimits, data = responses)
summary(implementation_effort_govtermlimits)

# H2: when governor is term-limited, bureaucrats less likely to take governor's
# preferences into account
gov_stakeholder_govtermlimits <- lm(termlimits_governor_resp ~ termlimits_condition*gov_termlimits, data = responses)
summary(gov_stakeholder_govtermlimits)

wordreg(l=list(implementation_effort_govtermlimits, gov_stakeholder_govtermlimits),
        file = "TermLimitsExp_govtermlimitstates.doc",
        custom.coef.map = list("(Intercept)" = "Intercept",
                               "termlimits_conditionReelection" = "Governor Running for Re-election",
                               "termlimits_conditionTermLimited" = "Governor Term-limited",
                               "gov_termlimits" = "State Has Term Limits",
                               "termlimits_conditionReelection:gov_termlimits" = "Governor Running for Re-election:State Has Term Limits",
                               "termlimits_conditionTermLimited:gov_termlimits" = "Governor Term-Limited:State Has Term Limits"),
        custom.model.names = c("Implementation Effort Exerted", "Importance of Governor as Stakeholder"),
        caption = "Effect of Gubernatorial Term Limits on Bureaucratic Implementation of Executive Orders",
        caption.above = TRUE,
        stars = 0.10, # our pre-registration specified a critical value threshold 
                      # of p<=0.05 one-tailed, which is equivalent to p<=0.10 two-tailed
        include.rsquared = FALSE,
        include.adjrs = FALSE)

################################################################################

# TABLE SI.9

# creating a dichotomous indcator for whether the state has legislative term limits
responses$leg_termlimits <- ifelse(responses$state %in% c("Florida", "Indiana",
                                                          "Nebraska"), 1, NA)
responses$leg_termlimits <- ifelse(responses$state %in% c("Connecticut", "Illinois",
                                                          "Indiana",
                                                          "New Hampshire",
                                                          "North Carolina", 
                                                          "Oregon",
                                                          "Vermont"), 0, responses$leg_termlimits)

# H1: when governor is term-limited, bureaucrats less likely to exert effort on
# governor's priorities
implementation_effort_legtermlimits <- lm(termlimits_effort ~ termlimits_condition*leg_termlimits, data = responses)
summary(implementation_effort_legtermlimits)

# H2: when governor is term-limited, bureaucrats less likely to take governor's
# preferences into account
gov_stakeholder_legtermlimits <- lm(termlimits_governor_resp ~ termlimits_condition*leg_termlimits, data = responses)
summary(gov_stakeholder_legtermlimits)

wordreg(l=list(implementation_effort_legtermlimits, gov_stakeholder_legtermlimits),
        file = "TermLimitsExp_legtermlimitstates.doc",
        custom.coef.map = list("(Intercept)" = "Intercept",
                               "termlimits_conditionReelection" = "Governor Running for Re-election",
                               "termlimits_conditionTermLimited" = "Governor Term-limited",
                               "leg_termlimits" = "State Has Term Limits",
                               "termlimits_conditionReelection:leg_termlimits" = "Governor Running for Re-election:State Has Term Limits",
                               "termlimits_conditionTermLimited:leg_termlimits" = "Governor Term-Limited:State Has Term Limits"),
        custom.model.names = c("Implementation Effort Exerted", "Importance of Governor as Stakeholder"),
        caption = "Effect of Gubernatorial Term Limits on Bureaucratic Implementation of Executive Orders",
        caption.above = TRUE,
        stars = 0.10,
        include.rsquared = FALSE,
        include.adjrs = FALSE)

################################################################################

# TABLEs SI.10 and SI.11

# coding values for gubernatorial from Kousser and Ferguson (2024)

responses$gov_personalpower <- ifelse(responses$state=="Connecticut", 4.0, NA)
responses$gov_personalpower <- ifelse(responses$state=="Florida", 3.8, responses$gov_personalpower)
responses$gov_personalpower <- ifelse(responses$state=="Illinois", 3.8, responses$gov_personalpower)
responses$gov_personalpower <- ifelse(responses$state=="Indiana", 3.0, responses$gov_personalpower)
responses$gov_personalpower <- ifelse(responses$state=="Nebraska", 3.8, responses$gov_personalpower)
responses$gov_personalpower <- ifelse(responses$state=="New Hampshire", 3.0, responses$gov_personalpower)
responses$gov_personalpower <- ifelse(responses$state=="North Carolina", 3.3, responses$gov_personalpower)
responses$gov_personalpower <- ifelse(responses$state=="Oregon", 3.3, responses$gov_personalpower)
responses$gov_personalpower <- ifelse(responses$state=="Vermont", 4.8, responses$gov_personalpower)

responses$gov_institutionalpower <- ifelse(responses$state=="Connecticut", 3.7, NA)
responses$gov_institutionalpower <- ifelse(responses$state=="Florida", 3.2, responses$gov_institutionalpower)
responses$gov_institutionalpower <- ifelse(responses$state=="Illinois", 3.6, responses$gov_institutionalpower)
responses$gov_institutionalpower <- ifelse(responses$state=="Indiana", 3.5, responses$gov_institutionalpower)
responses$gov_institutionalpower <- ifelse(responses$state=="Nebraska", 3.2, responses$gov_institutionalpower)
responses$gov_institutionalpower <- ifelse(responses$state=="New Hampshire", 3.2, responses$gov_institutionalpower)
responses$gov_institutionalpower <- ifelse(responses$state=="North Carolina", 2.3, responses$gov_institutionalpower)
responses$gov_institutionalpower <- ifelse(responses$state=="Oregon", 3.1, responses$gov_institutionalpower)
responses$gov_institutionalpower <- ifelse(responses$state=="Vermont", 2.6, responses$gov_institutionalpower)

# H1: when governor is term-limited, bureaucrats less likely to exert effort on
# governor's priorities
implementation_effort_personalpower <- lm(termlimits_effort ~ termlimits_condition*gov_personalpower, data = responses)
summary(implementation_effort_personalpower)

# H2: when governor is term-limited, bureaucrats less likely to take governor's
# preferences into account
gov_stakeholder_personalpower <- lm(termlimits_governor_resp ~ termlimits_condition*gov_personalpower, data = responses)
summary(gov_stakeholder_personalpower)

# TABLE SI.10

wordreg(l=list(implementation_effort_personalpower, gov_stakeholder_personalpower),
        file = "TermLimitsExp_personalpower.doc",
        custom.coef.map = list("(Intercept)" = "Intercept",
                               "termlimits_conditionReelection" = "Governor Running for Re-election",
                               "termlimits_conditionTermLimited" = "Governor Term-limited",
                               "gov_personalpower" = "Personal Power of Respondent's Governor",
                               "termlimits_conditionReelection:gov_personalpower" = "Governor Running for Re-election:Personal Power",
                               "termlimits_conditionTermLimited:gov_personalpower" = "Governor Term-Limited:Personal Power"),
        custom.model.names = c("Implementation Effort Exerted", "Importance of Governor as Stakeholder"),
        caption = "Effect of Gubernatorial Term Limits on Bureaucratic Implementation of Executive Orders Conditioned by Personal Power of Respondent's Governor",
        caption.above = TRUE,
        stars = 0.10,
        include.rsquared = FALSE,
        include.adjrs = FALSE)

# H1: when governor is term-limited, bureaucrats less likely to exert effort on
# governor's priorities
implementation_effort_institutionalpower <- lm(termlimits_effort ~ termlimits_condition*gov_institutionalpower, data = responses)
summary(implementation_effort_institutionalpower)

# H2: when governor is term-limited, bureaucrats less likely to take governor's
# preferences into account
gov_stakeholder_institutionalpower <- lm(termlimits_governor_resp ~ termlimits_condition*gov_institutionalpower, data = responses)
summary(gov_stakeholder_institutionalpower)

# TABLE SI.11

wordreg(l=list(implementation_effort_institutionalpower, gov_stakeholder_institutionalpower),
        file = "Tables\\TermLimitsExp_institutionalpower.doc",
        custom.coef.map = list("(Intercept)" = "Intercept",
                               "termlimits_conditionReelection" = "Governor Running for Re-election",
                               "termlimits_conditionTermLimited" = "Governor Term-limited",
                               "gov_institutionalpower" = "Personal Power of Respondent's Governor",
                               "termlimits_conditionReelection:gov_institutionalpower" = "Governor Running for Re-election:Personal Power",
                               "termlimits_conditionTermLimited:gov_institutionalpower" = "Governor Term-Limited:Personal Power"),
        custom.model.names = c("Implementation Effort Exerted", "Importance of Governor as Stakeholder"),
        caption = "Effect of Gubernatorial Term Limits on Bureaucratic Implementation of Executive Orders Conditioned by Personal Power of Respondent's Governor",
        caption.above = TRUE,
        stars = 0.10,
        include.rsquared = FALSE,
        include.adjrs = FALSE)